import { createRouter, createWebHistory } from 'vue-router'


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/login' // 重定向到 /home
    },
    {
      path: '/login',
      name: 'login',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/login/index.vue')
    },
    {
      path: '/home',
      name: 'home',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('@/views/index.vue'),
      children: [
        {
          path: 'user',
          name: 'user',
          component: () => import('@/views/user/index.vue')
        },
        {
          path: 'manuscript',
          name: 'manuscript',
          component: () => import('@/views/manuscript/index.vue')
        },
        {
          path: 'duty',
          name: 'duty',
          component: () => import('@/views/user/duty.vue')
        },
        {
          path: 'month_score',
          name: 'month_score',
          component: () => import('@/views/manuscript/month_score.vue')
        },
        {
          path: 'statistics',
          name: 'statistics',
          component: () => import('@/views/statistics/index.vue')
        },
        {
          path: 'operate',
          name: 'operate',
          component: () => import('@/views/rewards_punishments/operate_rewards.vue')
        }
      ]
    },

  ]
})

export default router
